package com.maben.server002;

import com.alibaba.fastjson.JSON;
import com.test.webservice.server002.WeatherModel;
import com.test.webservice.server002.WeatherService;
import com.test.webservice.server002.WeatherServiceInterface;

import java.util.List;

/**
 * 天气查询客户端（进阶版）
 */
public class Client {
    public static void main(String[] args) {
        //创建服务视图 -- @WebService -- serviceName = "weatherService",
        WeatherService weatherService = new WeatherService();
        //通过服务视图找到服务端点 -- @WebService  -- name = "weatherServiceInterface11"
        WeatherServiceInterface port = weatherService.getPort(WeatherServiceInterface.class);
        //调用具体方法
        List<WeatherModel> list = port.queryWeather("天津");
        for (WeatherModel weatherModel : list) {
            System.out.println(JSON.toJSONString(weatherModel));
        }
    }
}
